package com.wfs.aoawlms.mapper;

import com.wfs.aoawlms.pojo.Log;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LogMapper {

    List<Log> list(@Param("problem_type")String problem_type,@Param("name") String name);
    @Select("SELECT region_id FROM tb_region WHERE #{regionName} = region_name")
    int getRegionId(String regionName);
    void addLog(@Param("log") Log log, @Param("region_id") int region_id);
    @Delete("DELETE FROM tb_log WHERE #{logId}=tb_log.log_id")
    void deleteLog(Integer logId);
    void editLog(@Param("log") Log log, @Param("region_id") int region_id);
    @Select("SELECT log_id FROM tb_log WHERE name=#{name} and description=#{description} and solution=#{solution} and is_solved=#{is_solved}")
    int getLogId(@Param("name")String name, @Param("description")String description, @Param("solution")String solution, @Param("is_solved")Boolean isSolved);
    @Update("UPDATE tb_log SET diagram = #{imageName} WHERE log_id = #{logId}")
    void upload(@Param("imageName")String imageName,@Param("logId")Integer logId);
}
